<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title><s:text name="title" /></title>
	</head>
	<body>
		<p>
			<a href="./main.action"><s:text name="return" /> </a>
			<s:if test="#session.user.type>=1">
				<a href="../login/logOut.action"><s:text name="logOut" /> </a>
			</s:if>
		</p>
		<s:if test="method=='booking'&&successFlag==true"><s:text name="booking.success"/></s:if>
		<s:if test="method=='booking'&&successFlag==false"><s:text name="booking.failure"/></s:if>
		<s:actionerror />
		<s:fielderror></s:fielderror>
		<s:if test="#session.user==null||#session.user.type==1">
			<p>
				<B><s:text name="flightInfo" /> </B>
			</p>
			<table cellspacing="1" cellpadding="1" border="1">
				<tr>
					<td align="right">
						<s:text name='flight.name' />
					</td>
					<td align="left">
						<s:property value="flight.name" />
					</td>
				</tr>
				<tr>
					<td align="right">
						<s:text name='airportName' />
					</td>
					<td align="left">
						<s:property value="flight.airportName" />
					</td>
				</tr>
				<tr>
					<td align="right">
						<s:text name='flightDate' />
					</td>
					<td align="left">
						<s:property value="flight.flightDate" />
					</td>
				</tr>
				<tr>
					<td align="right">
						<s:text name='flightTime' />
					</td>
					<td align="left">
						<s:property value="flight.flightTime" />
					</td>
				</tr>
				<tr>
					<td align="right">
						<s:text name='flight.description' />
					</td>
					<td align="left">
						<s:property value="flight.description" />
					</td>
				</tr>
				<tr>
					<td align="right">
						<s:text name='flight.price' />
					</td>
					<td align="left">
						<s:property value="flight.price" />
					</td>
				</tr>
				<tr>
					<td align="right">
						<s:text name='flight.discount' />
					</td>
					<td align="left">
						<s:property value="flight.discount" />
					</td>
				</tr>
				<tr>
					<td align="right">
						<s:text name='flight.airportTax' />
					</td>
					<td align="left">
						<s:property value="flight.airportTax" />
					</td>
				</tr>
				<tr>
					<td align="right">
						<s:text name='flight.gst' />
					</td>
					<td align="left">
						<s:property value="flight.gst" />
					</td>
				</tr>
				<tr>
					<td align="right">
						<s:text name='flight.totalNum' />
					</td>
					<td align="left">
						<s:property value="flight.totalNum" />
					</td>
				</tr>
				<tr>
					<td align="right">
						<s:text name='flight.leftNum' />
					</td>
					<td align="left">
						<s:property value="flight.leftNum" />
					</td>
				</tr>
			</table>
			<p>
				<b><s:text name="userTicketInfo" /> </b>
			</p>
			<table cellspacing="1" cellpadding="1" border="1">
				<s:if test="'query'==method">
					<s:form action="bookingConfirm" namespace="/mainService">
						<tr>
							<td align="right">
								<s:text name='userTicket.num' />
							</td>
							<td align="left">
								<s:textfield name="num" />
							</td>
						</tr>
						<input type="hidden" name="flightId"
							value="<s:property value='flight.id'/>">
						<input type="hidden" name="flightDate"
							value="<s:property value='flight.flightDate'/>">
						<input type="hidden" name="price"
							value="<s:property value='flight.price'/>">
						<s:if test="#session.user==null">
							<tr>
								<td align="right">
									<s:text name='realName' />
								</td>
								<td align="left">
									<s:textfield name="realName" />
								</td>
							</tr>
							<tr>
								<td align="right">
									<s:text name='idCard' />
								</td>
								<td align="left">
									<s:textfield name="idCard" />
								</td>
							</tr>
						</s:if>
						<s:elseif test="#session.user.type==1">
							<input type="hidden" name="userId"
								value="<s:property value='#session.user.id'/>">
							<input type="hidden" name="realName"
								value="<s:property value='#session.user.realName'/>">
							<input type="hidden" name="idCard"
								value="<s:property value='#session.user.idCard'/>">
						</s:elseif>
						<s:if test="successFlag==true">
							<tr>
								<td></td>
								<td align="left">
									<s:submit key="flight.booking" />
								</td>
							</tr>
						</s:if>
					</s:form>
				</s:if>
				<s:elseif test="'confirm'==method">
					<s:form action="booking" namespace="/mainService">
						<tr>
							<td align="right">
								<s:text name='userTicket.num' />
							</td>
							<td align="left">
								<s:textfield name="num" readonly="true"/>
							</td>
						</tr>
						<tr>
							<td align="right">
								<s:text name='userTicket.discount' />
							</td>
							<td align="left">
								<s:textfield name="discount" readonly="true"/>
							</td>
						</tr>
						<tr>
							<td align="right">
								<s:text name='userTicket.airportTax' />
							</td>
							<td align="left">
								<s:textfield name="airportTax" readonly="true"/>
							</td>
						</tr>
						<tr>
							<td align="right">
								<s:text name='userTicket.gst' />
							</td>
							<td align="left">
								<s:textfield name="gst" readonly="true"/>
							</td>
						</tr>
						<tr>
							<td align="right">
								<s:text name='userTicket.totalPrice' />
							</td>
							<td align="left">
								<s:textfield name="totalPrice" readonly="true"/>
							</td>
						</tr>
						<input type="hidden" name="flightId"
							value="<s:property value='userTicket.flightId'/>">
						<input type="hidden" name="flightDate"
							value="<s:property value='flight.flightDate'/>">
						<input type="hidden" name="price"
							value="<s:property value='userTicket.price'/>">
						<s:if test="#session.user==null">
							<tr>
								<td align="right">
									<s:text name='realName'/>
								</td>
								<td align="left">
									<s:textfield name="realName" readonly="true"/>
								</td>
							</tr>
							<tr>
								<td align="right">
									<s:text name='idCard' />
								</td>
								<td align="left">
									<s:textfield name="userTicket.idCard" readonly="true" />
								</td>
							</tr>
						</s:if>
						<s:elseif test="#session.user.type==1">
							<input type="hidden" name="userId"
								value="<s:property value='#session.user.id'/>">
							<input type="hidden" name="realName"
								value="<s:property value='#session.user.realName'/>">
							<input type="hidden" name="idCard"
								value="<s:property value='#session.user.idCard'/>">
						</s:elseif>
						<s:if test="successFlag==true">
							<tr>
								<td></td>
								<td align="left">
									<s:submit key="flight.confirm" />
								</td>
							</tr>
						</s:if>
					</s:form>
				</s:elseif>
				<s:elseif test="'booking'==method">
					<tr>
						<td align="right">
							<s:text name='userTicket.num' />
						</td>
						<td align="left">
							<s:property value="userTicket.num" />
						</td>
					</tr>
					<tr>
						<td align="right">
							<s:text name='userTicket.discount' />
						</td>
						<td align="left">
							<s:property value="discount"/>
						</td>
					</tr>
					<tr>
						<td align="right">
							<s:text name='userTicket.airportTax' />
						</td>
						<td align="left">
							<s:property value="airportTax"/>
						</td>
					</tr>
					<tr>
						<td align="right">
							<s:text name='userTicket.gst' />
						</td>
						<td align="left">
							<s:property value="gst"/>
						</td>
					</tr>
					<tr>
						<td align="right">
							<s:text name='userTicket.totalPrice' />
						</td>
						<td align="left">
							<s:property value="userTicket.totalPrice" />
						</td>
					</tr>
					<s:if test="#session.user==null">
						<tr>
							<td align="right">
								<s:text name='userTicket.realName' />
							</td>
							<td align="left">
								<s:property value="userTicket.realName" />
							</td>
						</tr>
						<tr>
							<td align="right">
								<s:text name='userTicket.idCard' />
							</td>
							<td align="left">
								<s:property value="userTicket.idCard" />
							</td>
						</tr>
					</s:if>
				</s:elseif>
			</table>
		</s:if>
	</body>
</html>
